from db import Session2, IpPool


def getIpNumFromIpPopl(ip):
    session2 = Session2()
    try:
        ip_info = session2.query(IpPool).filter(IpPool.ip == ip).first()
        if ip_info:
            return ip_info.id
        else:
            return None
        session2.close()
    except:
        session2.close()
        return -1
